package demo002;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public enum Week {
    // 枚举项就是枚举类的实例(下方有7个枚举项),在创建定义枚举项时其实就是创建枚举的实例,因此在定义枚举项就要传递实际的参数
    MONDAY("星期一", 1),
    TUESDAY("星期二"),
    WEDNESDAY,
    THURSDAY("星期四", 3),
    FRIDAY("星期五", 4),
    SATURDAY("星期六", 5),
    SUNDAY("星期六", 4);

    private String name;
    private Integer loveLevel;

    // 注意: 枚举类的构造方法只能是私有(默认情况下也是私有)
    Week() {                                    // 空参构造
    }

    Week(String name) {// 有参构造
        System.out.println("demo002.Week("+name+")方法调用");
        this.name = name;
    }

    Week(String name, Integer loveLevel) {      // 有参构造
        System.out.println("demo002.Week("+name+","+loveLevel+")方法调用");
        this.name = name;
        this.loveLevel = loveLevel;
    }

    public void show() {
        System.out.println("我是【" + name + "】,我的喜好程度是【" + loveLevel + "】颗星");
    }

    @Override
    public String toString() {
        return "demo002.Week{" +
                "name='" + name + '\'' +
                ", loveLevel=" + loveLevel +
                '}';
    }
}
